package com.atguigu.actual.edu0417.app;

import com.atguigu.actual.edu0417.unils.EnvUtil;
import org.apache.flink.api.common.restartstrategy.RestartStrategies;
import org.apache.flink.runtime.state.hashmap.HashMapStateBackend;
import org.apache.flink.streaming.api.CheckpointingMode;
import org.apache.flink.streaming.api.environment.CheckpointConfig;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @author: techyang
 * @since: 2023-10-19 11:01
 * @description: flinkAPI执行流程抽取
 **/
public abstract class BaseApp {

    public void base(String[] args) {
        // 流执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 并行度,检查点相关设置
        EnvUtil.baseEnv(env);

        // 业务逻辑处理
        process(env);

        // 执行
        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    // API方式
    public abstract void process(StreamExecutionEnvironment env);

}
